
import { useIntersectionObserver } from '@vueuse/core'
import { shallowRef, useTemplateRef } from 'vue'
export const  lazyPlugin={
  install(app){
    app.directive("img-lazy",{
      mounted(el,binding){
       const {stop}=  useIntersectionObserver(
          el,
          ([entry]) => {
            if(entry.isIntersecting){
              el.src=binding.value;
              stop();
            }
          },
        )
      },
      // unmounted(el){
      //   observer.unobserve(el);
      // }
    })
  }
}